"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const _sfc_main = {
  __name: "mood",
  setup(__props) {
    const showDrawer = common_vendor.ref(false);
    const userInput = common_vendor.ref("");
    const userHead = common_vendor.ref("");
    const open = () => {
      showDrawer.value = true;
    };
    const close = () => {
      showDrawer.value = false;
    };
    function getFormattedDate() {
      let now = /* @__PURE__ */ new Date();
      let year = now.getFullYear();
      let month = String(now.getMonth() + 1).padStart(2, "0");
      let day = String(now.getDate()).padStart(2, "0");
      let hours = String(now.getHours()).padStart(2, "0");
      let minutes = String(now.getMinutes()).padStart(2, "0");
      return `${year}/${month}/${day} ${hours}:${minutes}`;
    }
    const sendMessage = () => {
      if (userInput.value.length === 0) {
        return;
      } else {
        messages.value.unshift({
          id: messages.value.length,
          date: getFormattedDate(),
          avatar: userHead.value,
          message: userInput.value
        });
        userInput.value = "";
      }
    };
    const getUserInfo = (e) => {
      userHead.value = e.detail.userInfo.avatarUrl;
    };
    const messages = common_vendor.ref([
    
      {
        id: 1,
        date: "2024/11/7 21:48",
        avatar: "/static/ruanmei.jpg",
        message: "巴拉巴拉歪比巴卜思密达"
      },
      {
        id: 0,
        date: "2024/11/7 21:48",
        avatar: "/static/ruanmei.jpg",
        message: "巴拉巴拉歪比巴卜思密达"
      }
    ]);
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: showDrawer.value
      }, showDrawer.value ? {
        b: common_vendor.o(close)
      } : {}, {
        c: common_vendor.f(messages.value, (item, index, i0) => {
          return {
            a: item.avatar,
            b: common_vendor.t(item.date),
            c: common_vendor.t(item.message),
            d: index
          };
        }),
        d: userInput.value,
        e: common_vendor.o(($event) => userInput.value = $event.detail.value),
        f: common_assets._imports_0,
        g: common_vendor.o(sendMessage),
        h: showDrawer.value ? 1 : "",
        i: common_assets._imports_1,
        j: common_assets._imports_2,
        k: common_vendor.o(getUserInfo),
        l: common_vendor.o(open),
        m: common_assets._imports_3,
        n: common_assets._imports_4,
        o: common_assets._imports_5
      });
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f37212e2"]]);
wx.createPage(MiniProgramPage);
